主题
连接远程服务端 - ConnectRemoteEx
函数简介
在 A 端 连接 B 端远程服务,并在连接、CreateInstance 之后自动在 B 端执行 Reg(注册到后台)。
接口名称
ConnectRemoteExDLL调用
c
int32_t ConnectRemoteEx(int64_t instance, char* host, int32_t port,
char* token, char* userCode, char* softCode,
char* featureList, int32_t timeoutMs);参数说明
| 参数名 | 类型 | 说明 |
|---|---|---|
| instance | 长整数型 | OLAPlug 对象指针,由 CreateCOLAPlugInterFace 接口生成。 |
| host | 字符串 | B 端服务 IP 或域名。 |
| port | 整数型 | B 端监听端口。 |
| token | 字符串 | 与 B 端一致)。 |
| userCode | 字符串 | 用户码(用于 Reg)。 |
| softCode | 字符串 | 软件码(用于 Reg)。 |
| featureList | 字符串 | 功能列表(用于 Reg)。 |
| timeoutMs | 整数型 | 单次调用超时(毫秒);0 使用默认值。 |
示例
SDK 调用
cpp
#include "OLAPlugServer.h"
OLAPlugServer ola;
int ret = ola.ConnectRemoteEx("127.0.0.1", 9000, "token");csharp
using OLAPlug;
var ola = new OLAPlugServer();
int ret = ola.ConnectRemoteEx("127.0.0.1", 9000, "token");python
from OLAPlugServer import OLAPlugServer
ola = OLAPlugServer()
ret = ola.ConnectRemoteEx("127.0.0.1", 9000, "token")java
import com.olaplug.OLAPlugServer;
OLAPlugServer ola = new OLAPlugServer();
int ret = ola.ConnectRemoteEx("127.0.0.1", 9000, "token");cpp
var ola = com("OlaPlug.OlaSoft")
var ret = ola.ConnectRemoteEx("127.0.0.1", 9000, "token")vbscript
Set ola = CreateObject("OlaPlug.OlaSoft")
ret = ola.ConnectRemoteEx("127.0.0.1", 9000, "token")text
.局部变量 ola, OLAPlug
ola.创建 ()
ret = ola.ConnectRemoteEx(“127.0.0.1“, 9000, “token“)aardio
import OLAPlugServer;
var ola = OLAPlugServer();
var ret = ola.ConnectRemoteEx("127.0.0.1", 9000, "token");text
变量 ola <类型 = OLAPlugServer>
ola = 新建 OLAPlugServer
整数 ret = ola.ConnectRemoteEx("127.0.0.1", 9000, "token")cpp
#include "OLAPlugServer.h"
OLAPlugServer ola;
int ret = ola.ConnectRemoteEx("127.0.0.1", 9000, "token");原生 DLL 调用
cpp
long instance = CreateCOLAPlugInterFace();
ConnectRemoteEx(instance, "127.0.0.1", 9000, "token");csharp
long instance = CreateCOLAPlugInterFace();
ConnectRemoteEx(instance, "127.0.0.1", 9000, "token");python
from ctypes import CDLL, c_int, c_int64, create_string_buffer
ola = CDLL("OLAPlug_x64.dll")
ola.CreateCOLAPlugInterFace.restype = c_int64
instance = ola.CreateCOLAPlugInterFace()
ConnectRemoteEx(instance, "127.0.0.1", 9000, "token")返回值
1 成功,0 失败。
注意事项
- B 端须使用 空 token 调用 启动远程调度服务 - StartRemoteServer。
- 共享内存场景下的对应接口为 共享内存连接并在B端Reg - ConnectRemoteShmEx。
